From: Lukáš Tyrychtr Date: Fri, 16 Sep 2022 08:21:32 +0000 (+0200) Subject: Implement GtkAccessibleRange for GtkScaleButton X-Git-Tag: archive/raspbian/4.12.3+ds-1+rpi1~1^2^2^2~116^2~1^2~202^2~7 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=76a5354ad7d9d39f74633b620500122c4d775447;p=gtk4.git Implement GtkAccessibleRange for GtkScaleButton --- diff --git a/gtk/gtkscalebutton.c b/gtk/gtkscalebutton.c index 67d919c657..b97af7c4e8 100644 --- a/gtk/gtkscalebutton.c +++ b/gtk/gtkscalebutton.c @@ -36,6 +36,7 @@ #include "gtkscalebutton.h" +#include "gtkaccessiblerange.h" #include "gtkadjustment.h" #include "gtkbox.h" #include "gtkbuttonprivate.h" @@ -158,13 +159,38 @@ static gboolean gtk_scale_button_scroll_controller_scroll (GtkEventControllerScr double dx, double dy, GtkScaleButton *button); +static void gtk_scale_button_accessible_range_init(GtkAccessibleRangeInterface *iface); + G_DEFINE_TYPE_WITH_CODE (GtkScaleButton, gtk_scale_button, GTK_TYPE_WIDGET, G_ADD_PRIVATE (GtkScaleButton) + G_IMPLEMENT_INTERFACE (GTK_TYPE_ACCESSIBLE_RANGE, + gtk_scale_button_accessible_range_init) G_IMPLEMENT_INTERFACE (GTK_TYPE_ORIENTABLE, NULL)) static guint signals[LAST_SIGNAL] = { 0, }; +static double +gtk_scale_button_accessible_range_get_minimum_increment(GtkAccessibleRange *accessible_range) +{ + GtkScaleButton *button = GTK_SCALE_BUTTON (accessible_range); + return gtk_adjustment_get_minimum_increment (gtk_scale_button_get_adjustment (button)); +} + +static void +gtk_scale_button_accessible_range_set_current_value (GtkAccessibleRange *accessible_range, double value) +{ + GtkScaleButton *button = GTK_SCALE_BUTTON (accessible_range); + gtk_scale_button_set_value (button, value); +} + +static void +gtk_scale_button_accessible_range_init(GtkAccessibleRangeInterface *iface) +{ + iface->get_minimum_increment = gtk_scale_button_accessible_range_get_minimum_increment; + iface->set_current_value = gtk_scale_button_accessible_range_set_current_value; +} + static void gtk_scale_button_class_init (GtkScaleButtonClass *klass) {